package com.bto.solar.work.controller;

import com.bto.solar.work.common.R;
import com.bto.solar.work.entity.LeasePrjProject;
import com.bto.solar.work.service.BtoLeasePrjProjectService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 越秀-产品表 前端控制器
 * </p>
 *
 * @author shiyi
 * @since 2023-08-09
 */
@RestController
@RequestMapping("/leasePrjProject")
public class LeasePrjProjectController {

    @Autowired
    private BtoLeasePrjProjectService btoLeasePrjProjectService;

    /**
    * 进件信息页面展示
    * */
    @GetMapping("/get")
    public R<PageInfo<LeasePrjProject>> getLeasePrjProjectList(@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
                                            @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize){
        PageInfo<LeasePrjProject> leasePrjProjectList = btoLeasePrjProjectService.getLeasePrjProjectList(pageNum, pageSize);
        return R.ok(leasePrjProjectList , "进件信息数据请求成功");
    }

    /**
     * 进件信息修改
     * */
    @PutMapping("/update/{id}")
    public R update(@RequestBody(required = true) @ApiParam("修改进件信息") LeasePrjProject leasePrjProject ,
                            @PathVariable("id")  Integer id){
         btoLeasePrjProjectService.updateLeasePrjProject(id, leasePrjProject);
         return R.ok();
    }

}
